package com.aplink.generic.util.validation;

public class Range extends ValidationBase {

	private final int maxValue;
	private final int minValue;

	public Range() {
		this.minValue = 0;
		this.maxValue = 100;
		this.ErrorMessage = "";
	}

	public Range(final int minvalue, final int maxvalue,
	        final String errorMessage) {
		this.minValue = minvalue;
		this.maxValue = maxvalue;
		this.ErrorMessage = errorMessage;
	}

	@Override
	public boolean checkValidation(final Object currentValue) {
		if (currentValue instanceof Integer) {
			final int value = Integer.valueOf(currentValue.toString());
			if ((value >= this.minValue) && (value <= this.maxValue)) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public int getMaxValue() {
		return this.maxValue;
	}

	public int getMinValue() {
		return this.minValue;
	}

}
